package com.manage.model;

import java.io.Serializable;
import java.util.ArrayList;

import android.util.Log;

public class Order implements Serializable {

	private static final long serialVersionUID = 1L;
	
	private String orderID = "";  // 订单ID
	private String orderTime = ""; // 下单时间
	private ArrayList<OrderItem> dishes = null; // 菜品
	private ArrayList<OrderItem> delDishes = null; //删除的菜品
	private ArrayList<OrderItem> addDishes = null; //新增的菜品
	private String deliveryCosts = ""; // 配送费
	private String clientAddition = ""; // 补充(用户备注)
	
	private String clientName = ""; // 客户名
	private String phoneNumber = ""; // 客户电话号码
	private String clientBuilding = ""; // 送餐地址
	private String clientAddress = ""; // 送餐地址
	private String remark = ""; // 用户备注
	
	private String status = ""; //订单状态1:待受理订单，2：待配送订单，3：待入账订单，4：已完成,5:已取消
	private String taste = ""; //口味评分
	private String speed = ""; //速度评分
	private String service = ""; //服务评分
	
//	private String totalPrice = "";//总价
	
	// 备注

	// ========get method============
	public String getOrderID() {
		return this.orderID;
	}
	
	public String getClientName() {
		return this.clientName.equals("null")?"":this.clientName;
	}

	public String getOrderTime() {
		return this.orderTime;
	}

	public String getPhoneNumber() {
		return this.phoneNumber.equals("null")?"":this.phoneNumber;
	}

	public String getClientBuilding() {
		return this.clientBuilding.equals("null")?"":this.clientBuilding;
	}
	
	public String getClientAddress() {
		return this.clientAddress.equals("null")?"":this.clientAddress;
	}

	public String getClientAddition() {
		return this.clientAddition.equals("null")?"":this.clientAddition;
	}
	
	public ArrayList<OrderItem> getDishes() {
		return this.dishes;
	}
	
	public ArrayList<OrderItem> getDelDishes() {
		return this.delDishes;
	}
	
	public ArrayList<OrderItem> getAddDishes() {
		return this.addDishes;
	}
	public String getDeliveryCosts() {
		return this.deliveryCosts;
	}

	public String getRemark() {
		return (this.remark.equals("null") || this.remark.equals("-"))?"":this.remark;
	}

	public String getStatus() {
		return this.status.equals("null")?"":this.status;
	}

	public String getTaste() {
		return this.taste.equals("null") || this.taste == null?"":this.taste;
	}

	public String getSpeed() {
		return this.speed.equals("null") || this.speed == null?"":this.speed;
	}

	public String getService() {
		return this.service.equals("null") || this.service == null?"":this.service;
	}

//	public String getTotalPrice() {
//		return this.totalPrice;
//	}
	
	// ==============set method=================
	public void setOrderID(String paramString) {
		this.orderID = paramString;
	}
	
	public void setClientName(String paramString) {
		this.clientName = paramString;
	}

	public void setOrderTime(String paramString) {
		this.orderTime = paramString;
	}

	public void setPhoneNumber(String paramString) {
		this.phoneNumber = paramString;
	}

	public void setClientBuilding(String paramString) {
		this.clientBuilding = paramString;
	}
	
	public void setClientAddress(String paramString) {
		this.clientAddress = paramString;
	}

	public void setClientAddition(String paramString) {
		this.clientAddition = paramString;
	}

	public void setDishes(ArrayList<OrderItem> paramObject) {
		this.dishes = paramObject;
	}

	public void setDelDishes(ArrayList<OrderItem> paramObject) {
		this.delDishes = paramObject;
	}

	public void setAddDishes(ArrayList<OrderItem> paramObject) {
		this.addDishes = paramObject;
	}
	
	public void setDeliveryCosts(String paramString) {
		this.deliveryCosts = paramString;
	}
	
	public void setRemark(String paramString) {
		this.remark = paramString;
	}

	public void setStatus(String paramString) {
		this.status = paramString;
	}

	public void setTaste(String paramString) {
		this.taste = paramString;
	}

	public void setSpeed(String paramString) {
		this.speed = paramString;
	}

	public void setService(String paramString) {
		this.service = paramString;
	}

//	public void setTotalPrice(String paramString) {
//		this.totalPrice = paramString;
//	}
	
	/**
	 * 获取订单总价格
	 * @return
	 */
	public String getTotalPrice() {
		float totalPrice = 0.0f;
		
		for(int i=0; i< this.dishes.size(); i++) {
			OrderItem item = this.dishes.get(i);
			int count = Integer.valueOf(item.getCaipin_count());
			Log.i("count", ":"+count);
			float price = Float.valueOf(item.getCaipin_price());
			Log.i("price", ":"+price);
			totalPrice += count * price;
			Log.i("totalPrice", ":"+totalPrice);
		}
		return String.valueOf(totalPrice) + this.getDeliveryCosts();
	}
	
}
